package com.wc.alorithm_blue_bridge._二分.最少刷题数;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * @Author congge
 * @Date 2025/3/15 9:43
 * @description
 * https://www.lanqiao.cn/courses/46292/learning/?id=3949430&compatibility=false
 */
public class Main {
    /**
     * 思路：
     * 枚举加的个数, 检查超过与小于的个数
     */
    static FastReader sc = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);
    static int N = 100010;
    static int[] s = new int[N], a = new int[N];
    static int n;

    public static void main(String[] args) {
        n = sc.nextInt();
        for (int i = 1; i <= n; i++) {
            a[i] = sc.nextInt() + 1;
            s[a[i]]++;
        }
        for (int i = 1; i < N; i++) s[i] += s[i - 1];
        for (int i = 1; i <= n; i++) {
            int l = 0, r = N - a[i] - 1;
            while (l < r) {
                int mid = l + r >> 1;
                if (check(mid, i)) r = mid;
                else l = mid + 1;
            }
            out.print(r + " ");
        }
        out.println();
        out.flush();
    }

    static boolean check(int mid, int i) {
        int v = a[i] + mid;
        int L = s[v - 1] - (mid == 0 ? 0 : 1), R = s[N - 1] - s[v];
        return R <= L;
    }
}

class FastReader {
    StringTokenizer st;
    BufferedReader br;

    FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    String nextLine() {
        String s = "";
        try {
            s = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return s;
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    // 是否由下一个
    boolean hasNext() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                String line = br.readLine();
                if (line == null)
                    return false;
                st = new StringTokenizer(line);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return true;
    }
}

